<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- saved from url=(0047)http://www.turnkeylinux.org/blog/django-signals -->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" class="js"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

	<title>Django Signals: Be lazy, let stuff happen magically | TurnKey Linux Blog</title>
    <link rel="canonical" href="./Signals_files/Signals.htm">
	
<meta http-equiv="x-dns-prefetch-control" content="on">
<link rel="dns-prefetch" href="http://cdn.turnkeylinux.org/">
<script type="text/javascript" async="" src="./Signals_files/ga.js"></script><script type="text/javascript">window.CKEDITOR_BASEPATH = "/sites/all/modules/ckeditor/ckeditor/";</script>
<link rel="shortcut icon" href="http://cdn.turnkeylinux.org/sites/all/themes/turnkey/favicon.ico" type="image/x-icon">
	<!-- CSS aggregated by CDN module. -->
<link type="text/css" rel="stylesheet" media="all" href="./Signals_files/cdn_css_6a4eb0d87db9228e3cdccada99ab6313_views.css">
<link type="text/css" rel="stylesheet" media="all" href="./Signals_files/cdn_css_6a4eb0d87db9228e3cdccada99ab6313.css">
<!-- CSS aggregated by CDN module. -->
	<script type="text/javascript" src="./Signals_files/js_f171c2a6f13d71b16e4f78c360221430.js"></script>
<script type="text/javascript" src="./Signals_files/ckeditor.js"></script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
jQuery.extend(Drupal.settings, { "basePath": "/", "googleanalytics": { "trackOutgoing": 1, "trackMailto": 1, "trackDownload": 1, "trackDownloadExtensions": "7z|aac|arc|arj|asf|asx|avi|bin|csv|doc|exe|flv|gif|gz|gzip|hqx|jar|jpe?g|js|mp(2|3|4|e?g)|mov(ie)?|msi|msp|pdf|phps|png|ppt|qtm?|ra(m|r)?|sea|sit|tar|tgz|torrent|txt|wav|wma|wmv|wpd|xls|xml|z|zip" }, "hashcash": { "url": "/hashcash" }, "ckeditor": { "module_path": "/sites/all/modules/ckeditor", "editor_path": "/sites/all/modules/ckeditor/ckeditor", "ajaxToken": "c2ef1fab276f0b25d8e4c6f46847df7f", "theme": "turnkey", "settings": { "edit-comment": { "customConfig": "/sites/all/modules/ckeditor/ckeditor.config.js?1331813467", "defaultLanguage": "en", "toolbar": "\n[\n    [ \'Format\', \'Bold\', \'Italic\', \'-\', \'NumberedList\',\'BulletedList\', \'-\', \'Link\', \'Unlink\', \'Image\' ]\n]\n      ", "enterMode": 1, "shiftEnterMode": 2, "toolbarStartupExpanded": true, "width": "694", "height": 350, "skin": "kama", "format_tags": "p;div;pre;address;h1;h2;h3;h4;h5;h6", "scayt_autoStartup": false, "stylesCombo_stylesSet": "drupal:/sites/all/modules/ckeditor/ckeditor.styles.js", "contentsCss": [ "/sites/all/modules/ckeditor/ckeditor.css?a", "/sites/all/themes/turnkey//css/ckeditor.css?a" ], "uiColor": "#EFEFDE", "filters": [ "filter/0/1", "filter/3/1" ] } }, "autostart": { "edit-comment": true } }, "luceneapi_facet": { "luceneapi_node": { "limit": "0" } }, "views": { "ajax_path": [ "/views/ajax", "/views/ajax" ], "ajaxViews": [ { "view_name": "blog", "view_display_id": "block_3", "view_args": "", "view_path": "node/1021", "view_base_path": "blog", "view_dom_id": 1, "pager_element": 0 }, { "view_name": "archive", "view_display_id": "block", "view_args": "", "view_path": "node/1021", "view_base_path": "blog/archive", "view_dom_id": 3, "pager_element": 0 } ] }, "custom_search_target": "_self" });
//--><!]]>
</script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
$(document).ready(function(){
 $('ul#superfish-1').supersubs({
 minWidth: 12,
 maxWidth: 27,
 extraWidth: 1
}).superfish({
 delay: 1000,
animation: {opacity:'show',height:'show'},
 speed: 'fast',
 autoArrows: true,
 dropShadows: true
})
});
//--><!]]>
</script>
	<script type="text/javascript"> </script> 
<script type="text/javascript" src="./Signals_files/ckeditor.config.js"></script><style id="cke_ui_color" type="text/css"></style><link rel="stylesheet" type="text/css" href="./Signals_files/editor.css"><script type="text/javascript" src="./Signals_files/zh-cn.js"></script></head>
<body class="sidebar-left">
  <div id="container">
    <div id="content">

      <div id="top">&nbsp;</div>
      <a id="homelink" title="Library of Appliances for Virtual Machines, Cloud Computing, Bare Metal" href="http://www.turnkeylinux.org/">TurnKey Linux Virtual Appliance Library</a>

      <!-- optional masthead -->
      
      <!-- begin content area -->
      <!-- top -->
      <div id="bodyouter">
        <div id="center">
          <div id="squeeze">
                        <div id="breadcrumb" class="breadcrumb">
              <h3>You are here:</h3>
                
              <a href="http://www.turnkeylinux.org/">Home</a> » <a href="http://www.turnkeylinux.org/blog">Blog</a> » Django Signals: Be lazy, let stuff happen magically            </div>
                                                            
<div id="node-1021" class="node node-blog status-page">

    <div id="subscribe"><a title="Receive blog updates by RSS" class="rss" href="http://www.turnkeylinux.org/blog/feed">Subscribe</a> | <a rel="nofollow" title="Receive blog updates by e-mail" href="http://feedburner.google.com/fb/a/mailverify?uri=turnkeylinux-blog">By Email</a></div>
    <div class="tags"><ul class="links inline"><li class="taxonomy_term_54 first"><a href="http://www.turnkeylinux.org/blog/development" rel="tag" title="">development</a></li>
<li class="taxonomy_term_68 last"><a href="http://www.turnkeylinux.org/blog/django" rel="tag" title="">django</a></li>
</ul></div>
    
    <div class="blog-item">
        <h1 class="title">
            <a href="./Signals_files/Signals.htm">Django Signals: Be lazy, let stuff happen magically</a>
        </h1>
       
        
                <span class="submitted">By <a href="http://www.turnkeylinux.org/users/alon" title="View user profile.">Alon Swartz</a> 
         - <a class="comment-count" title="6 comments" href="http://www.turnkeylinux.org/blog/django-signals#comments">6 comments</a> | Latest by YemSalat
         </span>

       
        <div class="content"><p>
	When I first learned about <a href="http://docs.djangoproject.com/en/dev/topics/signals/">Django signals</a>, it gave me the same warm fuzzy feeling I got when I started using RSS. Define what I'm interested in, sit back, relax, and let the information come to me.</p>
<p>
	You can do the same in Django, but instead of getting news type notifications, you define what <em>stuff</em> should happen when other <em>stuff</em> happens, and best of all, the so-called <em>stuff</em> is global throughout your project, not just within applications (supporting decoupled apps).</p>
<p>
	For example:</p>
<ul>
	<li>
		Before a blog comment is published, check it for spam.</li>
	<li>
		After a user logs in successfully, update his twitter status.</li>
</ul>
<p>
	What you can do with signals are plentiful, and up to your imagination, so lets get into it.</p>

<h2>
	What are Django signals?</h2>
<p>
	In a nutshell, signals allow certain senders to notify a set of receivers that some action has taken place. They're especially useful when many pieces of code may be interested in the same events.</p>
<p>
	This might remind you of <a href="http://en.wikipedia.org/wiki/Event-driven_programming">Event driven programming</a>, and rightfully so, the core concepts are very similar.</p>
<p>
	Django provides a set of built-in signals that let user defined code get notified by Django itself of certain actions, for example:</p>
<pre><strong># Sent before or after a model's save() method is called.</strong>
django.db.models.signals.pre_save | post_save

<strong># Sent before or after a model's delete() method is called.</strong>
django.db.models.signals.pre_delete | post_delete

<strong># Sent when a ManyToManyField on a model is changed.</strong>
django.db.models.signals.m2m_changed

<strong># Sent when Django starts or finishes an HTTP request.</strong>
django.core.signals.request_started | request_finished
</pre>
<p>
	Built-in signals are really useful, but what I really like is the ability to define custom signals, and due to the way the <em>"signal dispatcher"</em> works, it allows decoupled applications to be notified when actions occur elsewhere in the framework.</p>
<p>
	In other words, one of your apps can send a signal when something happens, and a different app can listen for the signal and do something when it's received.<br>
	&nbsp;</p>
<h2>
	Using Django signals</h2>
<h3>
	Defining and sending a signal</h3>
<p>
	All signals are <em>django.dispatch.Signal</em> instances. The <em>providing_args</em> is a list of the names of arguments the signal will provide to listeners.</p>
<p>
	<strong>Application: foo</strong></p>
<pre class="prettyprint"><code><u><strong><span class="pln">signals</span><span class="pun">.</span><span class="pln">py</span></strong></u><span class="pln"><br><br></span><span class="kwd">from</span><span class="pln"> django</span><span class="pun">.</span><span class="pln">dispatch </span><span class="kwd">import</span><span class="pln"> </span><span class="typ">Signal</span><span class="pln"><br>user_login </span><span class="pun">=</span><span class="pln"> </span><span class="typ">Signal</span><span class="pun">(</span><span class="pln">providing_args</span><span class="pun">=[</span><span class="str">"request"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"user"</span><span class="pun">])</span><span class="pln"><br><br></span><u><strong><span class="pln">views</span><span class="pun">.</span><span class="pln">py</span></strong></u><span class="pln"><br><br></span><span class="kwd">from</span><span class="pln"> foo </span><span class="kwd">import</span><span class="pln"> signals<br><br></span><span class="kwd">def</span><span class="pln"> login</span><span class="pun">(</span><span class="pln">request</span><span class="pun">):</span><span class="pln"><br>&nbsp; &nbsp; </span><span class="pun">...</span><span class="pln"><br>&nbsp; &nbsp; </span><span class="kwd">if</span><span class="pln"> request</span><span class="pun">.</span><span class="pln">user</span><span class="pun">.</span><span class="pln">is_authenticated</span><span class="pun">():</span><span class="pln"><br>&nbsp; &nbsp; &nbsp; &nbsp; signals</span><span class="pun">.</span><span class="pln">user_login</span><span class="pun">.</span><span class="pln">send</span><span class="pun">(</span><span class="pln">sender</span><span class="pun">=</span><span class="kwd">None</span><span class="pun">,</span><span class="pln"> request</span><span class="pun">=</span><span class="pln">request</span><span class="pun">,</span><span class="pln"> user</span><span class="pun">=</span><span class="pln">request</span><span class="pun">.</span><span class="pln">user</span><span class="pun">)</span><span class="pln"><br>&nbsp; &nbsp; </span><span class="pun">...</span><span class="pln"><br></span></code></pre>
<p>
	In the above example, a signal will be sent once the user logs in successfully.<br>
	<br>
	Note: The above is just for exemplary purposes, it should be very rare to create your own authentication system as opposed to leveraging django.contrib.auth or one of the great apps out there.<br>
	<br>
	Just as a side note, <em>sender</em> is usually defined as <em>self</em> when sending the signal from a class, such as a model class. This gives the intercepting handler instant access to the related class instance.<br>
	&nbsp;</p>
<h3>
	Listening to signals</h3>
<p>
	To receive a signal, you need to register a receiver function that gets called when the signal is sent.</p>
<p>
	<strong>Application: bar</strong></p>
<pre class="prettyprint"><code><u><strong><span class="pln">tasks</span><span class="pun">.</span><span class="pln">py</span></strong></u><span class="pln"><br><br></span><span class="kwd">from</span><span class="pln"> foo</span><span class="pun">.</span><span class="pln">signals </span><span class="kwd">import</span><span class="pln"> user_login<br><br></span><span class="kwd">def</span><span class="pln"> user_login_handler</span><span class="pun">(</span><span class="pln">sender</span><span class="pun">,</span><span class="pln"> </span><span class="pun">**</span><span class="pln">kwargs</span><span class="pun">):</span><span class="pln"><br>&nbsp; &nbsp; </span><span class="str">"""signal intercept for user_login"""</span><span class="pln"><br>&nbsp; &nbsp; user </span><span class="pun">=</span><span class="pln"> kwargs</span><span class="pun">[</span><span class="str">'user'</span><span class="pun">]</span><span class="pln"><br>&nbsp; &nbsp; </span><span class="pun">...</span><span class="pln"><br><br>user_login</span><span class="pun">.</span><span class="pln">connect</span><span class="pun">(</span><span class="pln">user_login_handler</span><span class="pun">)</span><span class="pln"><br></span></code></pre>
<p>
	Now, when a user logs in successfully and the signal is sent, it will be intercepted and the handler can then do what ever is required. Note that multiple receivers can be registered for a single signal.<br>
	&nbsp;</p>
<h2>
	Where should the code live?</h2>
<p>
	You can put signal handling and registration code anywhere you like.<br>
	<br>
	However, you'll need to make sure that the module it's in gets imported early on so that the signal handling gets registered before any signals need to be sent. This makes your apps models.py a good place to put registration of signal handlers.<br>
	&nbsp;</p>
<h2>
	Integrating with django.contrib.auth</h2>
<p>
	Seeing as I opened the door to this, let me digress a little.<br>
	<br>
	The login and logout methods of <em>django.contrib.auth</em> do not send signals, and is discussed in this <a href="http://code.djangoproject.com/ticket/5612">ticket</a>. The main reason is that signals are synchronous (discussed in the next section) and would slow down the login/logout process.</p>
<p>
	If you do need authentication related signals, there are a few ways of accomplishing it, each with their own pros and cons, such as:</p>
<ul>
	<li>
		Patch django.contrib.auth</li>
	<li>
		Create a custom auth backend</li>
	<li>
		Create a wrapping view</li>
</ul>
<p>
	Creating a wrapping view provides the most flexibility, while writing less code and leveraging great code that already exists.<br>
	<br>
	<strong>Application: foo</strong></p>
<pre class="prettyprint"><code><u><strong><span class="pln">urls</span><span class="pun">.</span><span class="pln">py</span></strong></u><span class="pln"><br><br></span><span class="kwd">from</span><span class="pln"> django</span><span class="pun">.</span><span class="pln">conf</span><span class="pun">.</span><span class="pln">urls</span><span class="pun">.</span><span class="pln">defaults </span><span class="kwd">import</span><span class="pln"> </span><span class="pun">*</span><span class="pln"><br></span><span class="kwd">from</span><span class="pln"> foo</span><span class="pun">.</span><span class="pln">views </span><span class="kwd">import</span><span class="pln"> login<br><br>urlpatterns </span><span class="pun">=</span><span class="pln"> patterns</span><span class="pun">(</span><span class="str">''</span><span class="pun">,</span><span class="pln"><br>&nbsp; &nbsp;url</span><span class="pun">(</span><span class="pln">r</span><span class="str">'^login/$'</span><span class="pun">,</span><span class="pln"> login</span><span class="pun">,</span><span class="pln"><br>&nbsp; &nbsp; &nbsp; &nbsp;</span><span class="pun">{</span><span class="str">'template_name'</span><span class="pun">:</span><span class="pln"> </span><span class="str">'fooapp/login.html'</span><span class="pun">},</span><span class="pln"> name</span><span class="pun">=</span><span class="str">'auth_login'</span><span class="pun">),</span><span class="pln"><br>&nbsp; &nbsp;</span><span class="pun">)</span><span class="pln"><br><br></span><u><strong><span class="pln">views</span><span class="pun">.</span><span class="pln">py</span></strong></u><span class="pln"><br><br></span><span class="kwd">from</span><span class="pln"> django</span><span class="pun">.</span><span class="pln">contrib</span><span class="pun">.</span><span class="pln">auth</span><span class="pun">.</span><span class="pln">views </span><span class="kwd">import</span><span class="pln"> login </span><span class="kwd">as</span><span class="pln"> auth_login<br></span><span class="kwd">from</span><span class="pln"> foo </span><span class="kwd">import</span><span class="pln"> signals<br><br></span><span class="kwd">def</span><span class="pln"> login</span><span class="pun">(</span><span class="pln">request</span><span class="pun">,</span><span class="pln"> </span><span class="pun">**</span><span class="pln">kwargs</span><span class="pun">):</span><span class="pln"><br>&nbsp; &nbsp; </span><span class="str">"""workaround wrapper for auth.login that sends user_login signal"""</span><span class="pln"><br>&nbsp; &nbsp; response </span><span class="pun">=</span><span class="pln"> auth_login</span><span class="pun">(</span><span class="pln">request</span><span class="pun">,</span><span class="pln"> </span><span class="pun">**</span><span class="pln">kwargs</span><span class="pun">)</span><span class="pln"><br>&nbsp; &nbsp; </span><span class="kwd">if</span><span class="pln"> request</span><span class="pun">.</span><span class="pln">user</span><span class="pun">.</span><span class="pln">is_authenticated</span><span class="pun">():</span><span class="pln"><br>&nbsp; &nbsp; &nbsp; &nbsp; signals</span><span class="pun">.</span><span class="pln">user_login</span><span class="pun">.</span><span class="pln">send</span><span class="pun">(</span><span class="pln">sender</span><span class="pun">=</span><span class="kwd">None</span><span class="pun">,</span><span class="pln"> request</span><span class="pun">=</span><span class="pln">request</span><span class="pun">,</span><span class="pln"> user</span><span class="pun">=</span><span class="pln">request</span><span class="pun">.</span><span class="pln">user</span><span class="pun">)</span><span class="pln"><br><br>&nbsp; &nbsp; </span><span class="kwd">return</span><span class="pln"> response<br></span></code></pre>
<p>
	The above will wrap the <em>auth.login</em> method, and send a signal when a user successfully logs in. We are also passing a custom login template, but of course you don't need to.<br>
	&nbsp;</p>
<h2>
	Signals are synchronous</h2>
<p>
	As I mentioned above, signals are synchronous, or blocking (just like everything else in Django). This means that the request will not be returned until all signal handlers are done.</p>
<p>
	There have been multiple requests to add asynchronous support to Django, namely via the Python threading module, but I doubt it will happen anytime soon, if at all. In my opinion it comes down to <a href="http://en.wikipedia.org/wiki/Separation_of_concerns">separation of concerns</a>, and there is a whole other world called message queuing, namely <a href="http://en.wikipedia.org/wiki/Advanced_Message_Queuing_Protocol">AMQP</a> which is designed for these sort of things.</p>
<p>
	In an upcoming post I will discuss implementing AMQP (Advanced Message Queuing Protocol) with RabbitMQ and Celery.<br>
	&nbsp;</p>
<p>
	<strong>Ever needed to use signaling in your Django webapp? <a href="http://www.turnkeylinux.org/blog/django-signals#comment-form">Post a comment</a>!</strong></p></div>

                    <div class="after-post-message">
                <div>
                    Enjoyed this post? Get future posts <a href="http://feedburner.google.com/fb/a/mailverify?uri=turnkeylinux-blog">delivered
                    by email</a> or <a href="http://www.turnkeylinux.org/blog/feed">get the RSS
                    feed</a>. <br>Find us on <a href="http://www.facebook.com/turnkeylinux">Facebook</a> and <a href="http://twitter.com/turnkeylinux">Twitter</a>.</div><div class="fb-bottom">
<iframe src="data:text/html,chromewebdata" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:55px; height:65px;" allowtransparency="true"></iframe>
</div><div class="rt-bottom">    <script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>
    <div>
       <a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.turnkeylinux.org/blog/django-signals" data-via="turnkeylinux" data-text="Django Signals: Be lazy, let stuff happen magically" data-related="alonswartz:lirazsiri" data-count="vertical">Tweet</a>
    </div>
</div></div>
    </div>
<div class="mtime">Last update: Thu, January 19 - 18:41</div></div>

<div id="comments">
    <a href="http://www.turnkeylinux.org/blog/django-signals#comments"><h2>Comments</h2></a>
  
  <a id="comment-2418"></a>
<div class="comment comment-published odd">

    
<h2 class="title"><a href="http://www.turnkeylinux.org/blog/django-signals#comment-2418" class="active">I cannot seem to get this</a></h2>

    <div class="submitted">Derek - April 02, Fri 18:17.</div>
    <div class="content">I cannot seem to get this going.  I don;t need a custom login template - could you explain how to this without?  When I try to use:

url(r'^login/$', login, name='auth_login'),

in my urls.py I get an error.

Thanks!</div>

	      
    <div class="links"><ul class="links"><li class="comment_reply first last"><a href="http://www.turnkeylinux.org/comment/reply/1021/2418">reply</a></li>
</ul></div>
</div>
<a id="comment-2426"></a>
<div class="comment comment-published even">

    
<h2 class="title"><a href="http://www.turnkeylinux.org/blog/django-signals#comment-2426" class="active">Take 2</a></h2>

    <div class="submitted">Derek - April 03, Sat 10:56.</div>
    <div class="content">Have tried with some other options.  With urlpatterns += patterns('', (r'^login/$', 'myproject.mypapp.views.login', {'template_name': 'myapp/templates/admin/login.html'}),) I can get the login to work (adding the name='' gives a syntax error), but the user_login_handle function is never called (I added a print statement to the code there as a double check).  

What else can I try here?</div>

	      
    <div class="links"><ul class="links"><li class="comment_reply first last"><a href="http://www.turnkeylinux.org/comment/reply/1021/2426">reply</a></li>
</ul></div>
</div>
<a id="comment-2427"></a>
<div class="comment comment-by-author-of-post comment-published odd">

    <div class="picture">
  <a href="http://www.turnkeylinux.org/users/alon" title="View user profile."><img src="./Signals_files/picture-1.png" alt="Alon Swartz&#39;s picture" title="Alon Swartz&#39;s picture"></a></div>

<h2 class="title"><a href="http://www.turnkeylinux.org/blog/django-signals#comment-2427" class="active">More information required</a></h2>

    <div class="submitted"><a href="http://www.turnkeylinux.org/users/alon" title="View user profile.">Alon Swartz</a> - April 03, Sat 21:03.</div>
    <div class="content">Since version 1.0 (not sure what version you are using), Django has supported <a href="http://docs.djangoproject.com/en/dev/topics/http/urls/#id2">Naming URL patterns</a>. It's not required for signaling, but it's really useful when using the same view function in multiple URL patterns, and specifying urls in templates.<br>
<br>
Regarding your problem, could you post some code snippets? I'm not sure how productive it would be to make wild guesses. But, just for fun, you mentioned <i>user_login_handle</i>, my example was <i>user_login_handle<b>r</b></i>, could it be a typo?


</div>

	      
    <div class="links"><ul class="links"><li class="comment_reply first last"><a href="http://www.turnkeylinux.org/comment/reply/1021/2427">reply</a></li>
</ul></div>
</div>
<a id="comment-2754"></a>
<div class="comment comment-published even">

    
<h2 class="title"><a href="http://www.turnkeylinux.org/blog/django-signals#comment-2754" class="active">Thanks</a></h2>

    <div class="submitted">Guest - May 04, Tue 13:02.</div>
    <div class="content"><p>
	Was looking for a simple example of how to user custom signals. This article was very usefull. Thanks</p></div>

	      
    <div class="links"><ul class="links"><li class="comment_reply first last"><a href="http://www.turnkeylinux.org/comment/reply/1021/2754">reply</a></li>
</ul></div>
</div>
<a id="comment-6871"></a>
<div class="comment comment-published odd">

    
<h2 class="title"><a href="http://www.turnkeylinux.org/blog/django-signals#comment-6871" class="active">handler as class static method</a></h2>

    <div class="submitted">philgo20 - January 27, Thu 23:01.</div>
    <div class="content"><p>
	Kinda sucks that you can use a @stasticmethod decorator to make the handler a class static. Django complains that&nbsp;Signal receivers must accept keyword arguments (**kwargs).</p></div>

	      
    <div class="links"><ul class="links"><li class="comment_reply first last"><a href="http://www.turnkeylinux.org/comment/reply/1021/6871">reply</a></li>
</ul></div>
</div>
<a id="comment-11756"></a>
<div class="comment comment-published even">

    
<h2 class="title"><a href="http://www.turnkeylinux.org/blog/django-signals#comment-11756" class="active">easy example</a></h2>

    <div class="submitted">YemSalat - January 19, Thu 18:41.</div>
    <div class="content"><p>
	For those of you who couldnt get the article 'quite right'</p>
<p>
	Here's a quick example:</p>
<p>
	&nbsp;</p>
<p>
	&nbsp;</p>
<div id="cke_pastebin">
	# in models.py</div>
<div id="cke_pastebin">
	from django.db.models.signals import pre_delete</div>
<div id="cke_pastebin">
	from events.models import Event</div>
<div id="cke_pastebin">
	&nbsp;</div>
<div id="cke_pastebin">
	def do_something(sender, **kwargs):</div>
<div id="cke_pastebin">
	&nbsp; &nbsp; # the object which is saved can be accessed via kwargs 'instance' key.</div>
<div id="cke_pastebin">
	&nbsp; &nbsp; obj = kwargs['instance']</div>
<div id="cke_pastebin">
	&nbsp; &nbsp; print 'the object is now deleted'</div>
<div id="cke_pastebin">
	&nbsp; &nbsp; # ...do something else...</div>
<div id="cke_pastebin">
	&nbsp;</div>
<div id="cke_pastebin">
	# here we connect a pre_delete signal for MyModel</div>
<div id="cke_pastebin">
	# in other terms whenever an instance of MyModel is deleted</div>
<div id="cke_pastebin">
	# the 'do_something' function will be called.</div>
<div id="cke_pastebin">
	pre_delete.connect(do_something, sender=MyModel)</div></div>

	      
    <div class="links"><ul class="links"><li class="comment_reply first last"><a href="http://www.turnkeylinux.org/comment/reply/1021/11756">reply</a></li>
</ul></div>
</div>
  <div class="box">
    <h2 class="title">Post new comment</h2>    <div class="content"><form action="http://www.turnkeylinux.org/comment/reply/1021" accept-charset="UTF-8" method="post" id="comment-form" onsubmit="return hashcash_create(&quot;hashcash-comment_form&quot;);">
<div><div class="form-item" id="edit-name-wrapper">
 <label for="edit-name">Your name: <span class="form-required" title="This field is required.">*</span></label>
 <input type="text" maxlength="60" name="name" id="edit-name" size="30" value="" class="form-text required">
</div>
<div class="form-item" id="edit-mail-wrapper">
 <label for="edit-mail">E-mail: </label>
 <input type="text" maxlength="64" name="mail" id="edit-mail" size="30" value="" class="form-text">
 <div class="description">The content of this field is kept private and will not be shown publicly. If you have a <a href="http://www.gravatar.com/">Gravatar</a> account, used to display your avatar.</div>
</div>
<div class="form-item" id="edit-subject-wrapper">
 <label for="edit-subject">Subject: </label>
 <input type="text" maxlength="64" name="subject" id="edit-subject" size="60" value="" class="form-text">
</div>
<div class="form-item" id="edit-comment-wrapper">
 <label for="edit-comment">Comment: <span class="form-required" title="This field is required.">*</span></label>
 <div class="resizable-textarea"><span><textarea cols="60" rows="15" name="comment" id="edit-comment" class="form-textarea resizable required ckeditor-mod filterxss2 textarea-processed ckeditor-processed" style="visibility: hidden; display: none; "></textarea><span id="cke_edit-comment" onmousedown="return false;" class="cke_skin_kama cke_editor_edit-comment" dir="ltr" title="" lang="zh-cn" tabindex="0" style="width: 682px;"><span class="cke_browser_webkit"><span class="cke_wrapper cke_ltr"><table class="cke_editor" border="0" cellspacing="0" cellpadding="0"><tbody><tr style="-webkit-user-select: none; "><td id="cke_top_edit-comment" class="cke_top"><div class="cke_toolbox"><span id="cke_3" class="cke_toolbar"><span class="cke_toolbar_start"></span><span class="cke_rcombo"><span id="cke_4" class="cke_format cke_off"><span class="cke_label">格式</span><a hidefocus="true" title="格式" tabindex="-1" href="javascript:void('格式')" onkeydown="CKEDITOR.tools.callFunction( 4, event, this );" onclick="CKEDITOR.tools.callFunction(3, this); return false;"><span><span class="cke_accessibility">格式 </span><span id="cke_4_text" class="cke_text cke_inline_label">格式</span></span><span class="cke_openbutton"></span></a></span></span><span class="cke_toolgroup"><span class="cke_button"><a id="cke_5" class="cke_off cke_button_bold" href="javascript:void('加粗')" title="加粗" tabindex="-1" hidefocus="true" onkeydown="return CKEDITOR.ui.button._.keydown(0, event);" onfocus="return CKEDITOR.ui.button._.focus(0, event);" onclick="CKEDITOR.tools.callFunction(5, this); return false;"><span class="cke_icon"></span><span class="cke_label">加粗</span></a></span><span class="cke_button"><a id="cke_6" class="cke_off cke_button_italic" href="javascript:void('倾斜')" title="倾斜" tabindex="-1" hidefocus="true" onkeydown="return CKEDITOR.ui.button._.keydown(1, event);" onfocus="return CKEDITOR.ui.button._.focus(1, event);" onclick="CKEDITOR.tools.callFunction(6, this); return false;"><span class="cke_icon"></span><span class="cke_label">倾斜</span></a></span></span><span class="cke_separator"></span><span class="cke_toolgroup"><span class="cke_button"><a id="cke_7" class="cke_off cke_button_numberedlist" href="javascript:void('编号列表')" title="编号列表" tabindex="-1" hidefocus="true" onkeydown="return CKEDITOR.ui.button._.keydown(2, event);" onfocus="return CKEDITOR.ui.button._.focus(2, event);" onclick="CKEDITOR.tools.callFunction(7, this); return false;"><span class="cke_icon"></span><span class="cke_label">编号列表</span></a></span><span class="cke_button"><a id="cke_8" class="cke_off cke_button_bulletedlist" href="javascript:void('项目列表')" title="项目列表" tabindex="-1" hidefocus="true" onkeydown="return CKEDITOR.ui.button._.keydown(3, event);" onfocus="return CKEDITOR.ui.button._.focus(3, event);" onclick="CKEDITOR.tools.callFunction(8, this); return false;"><span class="cke_icon"></span><span class="cke_label">项目列表</span></a></span></span><span class="cke_separator"></span><span class="cke_toolgroup"><span class="cke_button"><a id="cke_9" class="cke_off cke_button_link" href="javascript:void('插入/编辑超链接')" title="插入/编辑超链接" tabindex="-1" hidefocus="true" onkeydown="return CKEDITOR.ui.button._.keydown(4, event);" onfocus="return CKEDITOR.ui.button._.focus(4, event);" onclick="CKEDITOR.tools.callFunction(9, this); return false;"><span class="cke_icon"></span><span class="cke_label">插入/编辑超链接</span></a></span><span class="cke_button"><a id="cke_10" class="cke_off cke_button_unlink" href="javascript:void('取消超链接')" title="取消超链接" tabindex="-1" hidefocus="true" onkeydown="return CKEDITOR.ui.button._.keydown(5, event);" onfocus="return CKEDITOR.ui.button._.focus(5, event);" onclick="CKEDITOR.tools.callFunction(10, this); return false;"><span class="cke_icon"></span><span class="cke_label">取消超链接</span></a></span><span class="cke_button"><a id="cke_11" class="cke_off cke_button_image" href="javascript:void('图象')" title="图象" tabindex="-1" hidefocus="true" onkeydown="return CKEDITOR.ui.button._.keydown(6, event);" onfocus="return CKEDITOR.ui.button._.focus(6, event);" onclick="CKEDITOR.tools.callFunction(11, this); return false;"><span class="cke_icon"></span><span class="cke_label">图象</span></a></span></span><span class="cke_toolbar_end"></span></span></div><a title="Collapse Toolbar" id="cke_12" class="cke_toolbox_collapser" onclick="CKEDITOR.tools.callFunction(12)"></a></td></tr><tr><td id="cke_contents_edit-comment" class="cke_contents" style="height:350px"><iframe style="width:100%;height:100%" frameborder="0" tabindex="-1" allowtransparency="true" title="富文本编辑器, edit-comment" name="富文本编辑器, edit-comment"></iframe></td></tr><tr style="-webkit-user-select: none; "><td id="cke_bottom_edit-comment" class="cke_bottom"><div id="cke_path_edit-comment" class="cke_path"><span class="cke_empty">&nbsp;</span></div><div class="cke_resizer" title="拖拽以改变尺寸" onmousedown="CKEDITOR.tools.callFunction(2, event)"></div></td></tr></tbody></table><style>.cke_skin_kama{visibility:hidden;}</style></span></span></span><div class="grippie" style="margin-right: -12px; display: none; "></div></span></div>
</div>
<ul class="tips"><li>Web page addresses and e-mail addresses turn into links automatically.</li><li>Allowed HTML tags:  &lt;a&gt; &lt;p&gt; &lt;span&gt; &lt;div&gt; &lt;h1&gt; &lt;h2&gt; &lt;h3&gt; &lt;h4&gt; &lt;h5&gt; &lt;h6&gt; &lt;img&gt; &lt;map&gt; &lt;area&gt; &lt;hr&gt; &lt;br&gt; &lt;br /&gt; &lt;ul&gt; &lt;ol&gt; &lt;li&gt; &lt;dl&gt; &lt;dt&gt; &lt;dd&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt; &lt;em&gt; &lt;b&gt; &lt;u&gt; &lt;i&gt; &lt;strong&gt; &lt;font&gt; &lt;del&gt; &lt;ins&gt; &lt;sub&gt; &lt;sup&gt; &lt;quote&gt; &lt;blockquote&gt; &lt;pre&gt; &lt;address&gt; &lt;code&gt; &lt;cite&gt; &lt;strike&gt; &lt;caption&gt;</li></ul><p><a href="http://www.turnkeylinux.org/filter/tips">More information about formatting options</a></p><input type="hidden" name="form_build_id" id="form-324b93eea59a36829033ded35864d08b" value="form-324b93eea59a36829033ded35864d08b">
<input type="hidden" name="form_id" id="edit-comment-form" value="comment_form">
<input type="hidden" name="hashcash" id="hashcash-comment_form" value="comment_form">
<div class="edit-title-wrapper"><div class="form-item" id="edit-title-wrapper">
 <input type="text" maxlength="128" name="title" id="edit-title" size="20" value="" class="form-text">
 <div class="description">Leave this field empty. It's part of a security mechanism.</div>
</div>
</div><div class="clear-block"><div class="form-item" id="edit-notify-wrapper">
 <label class="option" for="edit-notify"><input type="checkbox" name="notify" id="edit-notify" value="1" checked="checked" class="form-checkbox"> Notify me when new comments are posted</label>
</div>
<div class="form-radios"><div class="form-item" id="edit-notify-type-1-wrapper">
 <label class="option" for="edit-notify-type-1"><input type="radio" id="edit-notify-type-1" name="notify_type" value="1" checked="checked" class="form-radio"> All comments</label>
</div>
<div class="form-item" id="edit-notify-type-2-wrapper">
 <label class="option" for="edit-notify-type-2"><input type="radio" id="edit-notify-type-2" name="notify_type" value="2" class="form-radio"> Replies to my comment</label>
</div>
</div></div><input type="hidden" name="mollom[session_id]" id="edit-mollom-session-id" value="" class="mollom-session-id">
<div style="display: none;"><div class="form-item" id="edit-mollom-homepage-wrapper">
 <input type="text" maxlength="128" name="mollom[homepage]" id="edit-mollom-homepage" size="60" value="" title="Homepage" autocomplete="off" class="form-text">
</div>
</div><input type="submit" name="op" id="edit-preview" value="Preview" class="form-submit">
<div class="form-item" id="dear-spammers-wrapper">
 (Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)
</div>

</div></form>
</div>
 </div>

</div>
          
          </div>
        </div>

        <div id="footer" style="z-index: auto; ">
 <hr>
 <ul class="footer-sitemap">
  <li class="downloads"><span>Top downloads</span>
      <ul>
      <li><a href="http://www.turnkeylinux.org/lampstack">LAMP stack</a></li>
      <li><a href="http://www.turnkeylinux.org/fileserver">File server</a></li>
      <li><a href="http://www.turnkeylinux.org/joomla">Joomla</a></li>
      <li><a href="http://www.turnkeylinux.org/wordpress">Wordpress</a></li>
      <li><a href="http://www.turnkeylinux.org/redmine">Redmine</a></li>
      <li><a href="http://www.turnkeylinux.org/drupal6">Drupal</a></li>
      </ul>
  
  </li>
  <li class="about"><a href="http://www.turnkeylinux.org/about">About TurnKey</a>
      <ul>
      <li><a href="http://www.turnkeylinux.org/benefits">Why use TurnKey?</a></li>
      <li><a href="http://www.turnkeylinux.org/screenshots">Screenshots</a></li>
      <li><a href="http://www.turnkeylinux.org/blog">Blog</a> <a class="feed" href="http://www.turnkeylinux.org/blog/feed">&nbsp;</a> :: <a href="http://www.turnkeylinux.org/blog/news">News</a> <a class="feed" href="http://www.turnkeylinux.org/blog/news/feed">&nbsp;</a></li>

      <li><a href="http://www.turnkeylinux.org/mirrors">Mirrors</a> :: <a href="http://www.turnkeylinux.org/partners">Partners</a></li>
      <li><a href="http://www.turnkeylinux.org/help/conduct">Code of conduct</a></li>
      <li><a href="http://www.turnkeylinux.org/contact">Contact</a></li>
      </ul>
  </li>
  <li class="features"><a href="http://www.turnkeylinux.org/benefits">Features</a>
      <ul>
      <li><a href="http://www.turnkeylinux.org/core">Core: common base appliance</a></li>
      <li><a href="https://hub.turnkeylinux.org/">TurnKey Hub: cloud deployment</a></li>
      <li><a href="http://www.turnkeylinux.org/tklbam">TKLBAM: backup and migration</a></li>
      <li><a href="http://www.turnkeylinux.org/docs/cloudtask">CloudTask: cloud batch execution</a></li>
      <li><a href="http://www.turnkeylinux.org/docs/tklpatch">TKLPatch: customization SDK</a></li>
      </ul>
  
  </li>
  <li class="help"><a href="http://www.turnkeylinux.org/help">Help</a>
      <ul>
      <li><a href="http://www.turnkeylinux.org/forum">Forums</a></li>
      <li><a href="http://www.turnkeylinux.org/docs">Documentation</a></li>
      <li><a href="http://www.turnkeylinux.org/faq">Frequently Asked Questions</a></li>
      <li><a href="http://www.turnkeylinux.org/help/dev">Development</a></li>
      <li><a href="http://www.turnkeylinux.org/help/donate">Donate</a></li>
      </ul>
  </li>
  <li class="categories"><a href="http://www.turnkeylinux.org/all">Virtual appliances (45)</a>
      <ul>
      <li><a href="http://www.turnkeylinux.org/specials">Specials</a> (7)</li>
      <li><a href="http://www.turnkeylinux.org/web-development">Web development</a> (16)</li>
      <li><a href="http://www.turnkeylinux.org/cms">Content management</a> (23)</li>
      <li><a href="http://www.turnkeylinux.org/messaging">Messaging</a> (6)</li>
      <li><a href="http://www.turnkeylinux.org/issue-tracking">Issue tracking</a> (10)</li>
      </ul>
  
  </li>

 </ul>
 
 <div class="copyright">© 2008-2012 Turnkey Linux - All rights reserved</div>
 <div id="footer-border">&nbsp;</div>

</div>

        <div id="topNav">

  <div class="block block-superfish" id="block-superfish-1">


    <div class="content"><ul class="sf-menu sf-horizontal sf-style-default sf-js-enabled sf-shadow" id="superfish-1">
<li id="menu-2953-1" class="first odd sf-item-1 menuparent"><a href="http://www.turnkeylinux.org/all" title="Listing of all TurnKey Linux virtual appliances" class="sf-with-ul">Apps<span class="sf-sub-indicator"> »</span></a>
<ul style="display: none; float: none; width: 12em; visibility: hidden; ">
<li id="menu-2954-1" class="first odd sf-item-1" style="float: left; width: 100%; white-space: normal; "><a href="http://www.turnkeylinux.org/specials" title="" style="float: none; width: auto; ">Specials</a></li>
<li id="menu-2955-1" class="even sf-item-2 menuparent" style="float: left; width: 100%; white-space: normal; "><a href="http://www.turnkeylinux.org/web-development" title="" style="float: none; width: auto; " class="sf-with-ul">Web development<span class="sf-sub-indicator"> »</span></a>
<ul style="display: none; left: 12em; float: none; width: 12em; visibility: hidden; ">
<li id="menu-2956-1" class="first odd sf-item-1" style="float: left; width: 100%; white-space: normal; "><a href="http://www.turnkeylinux.org/framework" title="" style="float: none; width: auto; ">Framework</a></li>
<li id="menu-2957-1" class="last even sf-item-2" style="float: left; width: 100%; white-space: normal; "><a href="http://www.turnkeylinux.org/stacks" title="" style="float: none; width: auto; ">Stack</a></li>
</ul>
</li>
<li id="menu-2958-1" class="odd sf-item-3 menuparent" style="float: left; width: 100%; white-space: normal; "><a href="http://www.turnkeylinux.org/cms" title="" style="float: none; width: auto; " class="sf-with-ul">Content management<span class="sf-sub-indicator"> »</span></a>
<ul style="display: none; left: 12em; float: none; width: 12em; visibility: hidden; ">
<li id="menu-2959-1" class="first odd sf-item-1" style="float: left; width: 100%; white-space: normal; "><a href="http://www.turnkeylinux.org/blogging" title="" style="float: none; width: auto; ">Blogging</a></li>
<li id="menu-2960-1" class="even sf-item-2" style="float: left; width: 100%; white-space: normal; "><a href="http://www.turnkeylinux.org/wiki" title="" style="float: none; width: auto; ">Wiki</a></li>
<li id="menu-2961-1" class="last odd sf-item-3" style="float: left; width: 100%; white-space: normal; "><a href="http://www.turnkeylinux.org/ecommerce" title="" style="float: none; width: auto; ">Ecommerce</a></li>
</ul>
</li>
<li id="menu-2962-1" class="even sf-item-4 menuparent" style="float: left; width: 100%; white-space: normal; "><a href="http://www.turnkeylinux.org/messaging" title="" style="float: none; width: auto; " class="sf-with-ul">Messaging<span class="sf-sub-indicator"> »</span></a>
<ul style="display: none; left: 12em; float: none; width: 12em; visibility: hidden; ">
<li id="menu-2963-1" class="first odd sf-item-1" style="float: left; width: 100%; white-space: normal; "><a href="http://www.turnkeylinux.org/email" title="" style="float: none; width: auto; ">Email</a></li>
<li id="menu-2964-1" class="last even sf-item-2" style="float: left; width: 100%; white-space: normal; "><a href="http://www.turnkeylinux.org/taxonomy/term/25" title="" style="float: none; width: auto; ">Forum</a></li>
</ul>
</li>
<li id="menu-2965-1" class="odd sf-item-5 menuparent" style="float: left; width: 100%; white-space: normal; "><a href="http://www.turnkeylinux.org/issue-tracking" title="" style="float: none; width: auto; " class="sf-with-ul">Issue tracking<span class="sf-sub-indicator"> »</span></a>
<ul style="display: none; left: 12em; float: none; width: 12em; visibility: hidden; ">
<li id="menu-2966-1" class="first last odd sf-item-1" style="float: left; width: 100%; white-space: normal; "><a href="http://www.turnkeylinux.org/project-management" title="" style="float: none; width: auto; ">Project management</a></li>
</ul>
</li>
<li id="menu-2967-1" class="even sf-item-6" style="float: left; width: 100%; white-space: normal; "><a href="http://www.turnkeylinux.org/database" title="" style="float: none; width: auto; ">Database</a></li>
<li id="menu-2968-1" class="last odd sf-item-7" style="float: left; width: 100%; white-space: normal; "><a href="http://www.turnkeylinux.org/sdk" title="" style="float: none; width: auto; ">SDK</a></li>
</ul>
</li>
<li id="menu-84-1" class="even sf-item-2 menuparent"><a href="http://www.turnkeylinux.org/help" title="" class="sf-with-ul">Help<span class="sf-sub-indicator"> »</span></a>
<ul style="display: none; float: none; width: 12em; visibility: hidden; ">
<li id="menu-2667-1" class="first odd sf-item-1 menuparent" style="float: left; width: 100%; white-space: normal; "><a href="http://www.turnkeylinux.org/forum" title="" style="float: none; width: auto; " class="sf-with-ul">Forums<span class="sf-sub-indicator"> »</span></a>
<ul style="display: none; left: 12em; float: none; width: 12em; visibility: hidden; ">
<li id="menu-2668-1" class="first odd sf-item-1" style="float: left; width: 100%; white-space: normal; "><a href="http://www.turnkeylinux.org/forum/support" title="" style="float: none; width: auto; ">Support</a></li>
<li id="menu-2669-1" class="last even sf-item-2" style="float: left; width: 100%; white-space: normal; "><a href="http://www.turnkeylinux.org/forum/general" title="" style="float: none; width: auto; ">General</a></li>
</ul>
</li>
<li id="menu-2670-1" class="even sf-item-2" style="float: left; width: 100%; white-space: normal; "><a href="http://www.turnkeylinux.org/docs" title="" style="float: none; width: auto; ">Documentation</a></li>
<li id="menu-71-1" class="odd sf-item-3" style="float: left; width: 100%; white-space: normal; "><a href="http://www.turnkeylinux.org/faq" title="Frequently Asked Questions" style="float: none; width: auto; ">Questions &amp; Answers</a></li>
<li id="menu-2671-1" class="last even sf-item-4 menuparent" style="float: left; width: 100%; white-space: normal; "><a href="http://www.turnkeylinux.org/help/dev" title="" style="float: none; width: auto; " class="sf-with-ul">Development<span class="sf-sub-indicator"> »</span></a>
<ul style="display: none; left: 12em; float: none; width: 12em; visibility: hidden; ">
<li id="menu-2672-1" class="first odd sf-item-1" style="float: left; width: 100%; white-space: normal; "><a href="http://www.turnkeylinux.org/docs/tklpatch" title="" style="float: none; width: auto; ">SDK</a></li>
<li id="menu-2673-1" class="even sf-item-2" style="float: left; width: 100%; white-space: normal; "><a href="http://wiki.turnkeylinux.org/" title="" style="float: none; width: auto; ">Wiki</a></li>
<li id="menu-2674-1" class="odd sf-item-3" style="float: left; width: 100%; white-space: normal; "><a href="https://blueprints.launchpad.net/turnkeylinux" title="" style="float: none; width: auto; ">Blueprints</a></li>
<li id="menu-2675-1" class="even sf-item-4" style="float: left; width: 100%; white-space: normal; "><a href="https://bugs.launchpad.net/turnkeylinux" title="" style="float: none; width: auto; ">Bug tracker</a></li>
<li id="menu-2676-1" class="odd sf-item-5" style="float: left; width: 100%; white-space: normal; "><a href="http://code.turnkeylinux.org/" title="" style="float: none; width: auto; ">Code</a></li>
<li id="menu-2677-1" class="last even sf-item-6" style="float: left; width: 100%; white-space: normal; "><a href="http://www.turnkeylinux.org/polls" title="" style="float: none; width: auto; ">Polls</a></li>
</ul>
</li>
</ul>
</li>
<li id="menu-77-1" class="odd sf-item-3 menuparent"><a href="http://www.turnkeylinux.org/blog" title="" class="sf-with-ul">Blog<span class="sf-sub-indicator"> »</span></a>
<ul style="display: none; float: none; width: 12em; visibility: hidden; ">
<li id="menu-2679-1" class="first odd sf-item-1" style="float: left; width: 100%; white-space: normal; "><a href="http://www.turnkeylinux.org/blog" title="" style="float: none; width: auto; ">Category: All</a></li>
<li id="menu-2678-1" class="even sf-item-2" style="float: left; width: 100%; white-space: normal; "><a href="http://www.turnkeylinux.org/blog/news" title="" style="float: none; width: auto; ">Category: News</a></li>
<li id="menu-2934-1" class="odd sf-item-3" style="float: left; width: 100%; white-space: normal; "><a href="http://www.turnkeylinux.org/announcements" title="News and Security Announcements Newsletter" style="float: none; width: auto; ">E-mail Newsletter</a></li>
<li id="menu-2680-1" class="last even sf-item-4 menuparent" style="float: left; width: 100%; white-space: normal; "><a href="http://www.turnkeylinux.org/blog/feed" title="" style="float: none; width: auto; " class="sf-with-ul">Follow us<span class="sf-sub-indicator"> »</span></a>
<ul style="display: none; left: 12em; float: none; width: 12em; visibility: hidden; ">
<li id="menu-2794-1" class="first odd sf-item-1" style="float: left; width: 100%; white-space: normal; "><a href="http://www.facebook.com/turnkeylinux" title="" style="float: none; width: auto; ">Facebook</a></li>
<li id="menu-2683-1" class="even sf-item-2" style="float: left; width: 100%; white-space: normal; "><a href="http://twitter.com/turnkeylinux" title="" style="float: none; width: auto; ">Twitter</a></li>
<li id="menu-2681-1" class="odd sf-item-3" style="float: left; width: 100%; white-space: normal; "><a href="http://www.turnkeylinux.org/blog/feed" title="" style="float: none; width: auto; ">RSS feed</a></li>
<li id="menu-2682-1" class="last even sf-item-4" style="float: left; width: 100%; white-space: normal; "><a href="http://feedburner.google.com/fb/a/mailverify?uri=turnkeylinux-blog" title="" style="float: none; width: auto; ">Email</a></li>
</ul>
</li>
</ul>
</li>
<li id="menu-1735-1" class="even sf-item-4"><a href="http://www.turnkeylinux.org/screenshots" title="">Screenshots</a></li>
<li id="menu-2168-1" class="last odd sf-item-5"><a href="https://hub.turnkeylinux.org/" title="Cloud Backups and Server Deployment">TurnKey Hub</a></li>
</ul>
</div>
 </div>

    <div class="logged_out" id="account"> 

    <a href="http://www.turnkeylinux.org/user?destination=node%2F1021" title="Log into your account (supports OpenID)">Log in</a> | <a href="http://www.turnkeylinux.org/user/register" title="Create new account">Register</a>    </div>

    <form action="./Signals_files/Signals.htm" accept-charset="UTF-8" method="post" id="search-theme-form" class="search-form" target="_self">
<div><div id="search" class="container-inline">
  <div class="form-item" id="edit-search-theme-form-1-wrapper">
 <label class="element-invisible" for="edit-search-theme-form-1">Search this site: </label>
 <input type="text" maxlength="128" name="search_theme_form" id="edit-search-theme-form-1" size="15" value="Search" title="Enter the terms you wish to search for." class="form-text  custom-search-default-value custom-search-box">
</div>
<fieldset class="custom_search-popup custom_search-processed"><div class="custom-search-selector custom-search-types"><div class="form-item">
 <label>Refine your search: </label>
 <div class="form-radios"><div class="form-item" id="edit-custom-search-types-c-all-wrapper">
 <label class="option" for="edit-custom-search-types-c-all"><input type="radio" id="edit-custom-search-types-c-all" name="custom_search_types" value="c-all" checked="checked" class="form-radio"> All</label>
</div>
<div class="form-item" id="edit-custom-search-types-c-appliance-wrapper">
 <label class="option" for="edit-custom-search-types-c-appliance"><input type="radio" id="edit-custom-search-types-c-appliance" name="custom_search_types" value="c-appliance" class="form-radio"> Appliance</label>
</div>
<div class="form-item" id="edit-custom-search-types-c-blog-wrapper">
 <label class="option" for="edit-custom-search-types-c-blog"><input type="radio" id="edit-custom-search-types-c-blog" name="custom_search_types" value="c-blog" class="form-radio"> Blog</label>
</div>
<div class="form-item" id="edit-custom-search-types-c-doc-wrapper">
 <label class="option" for="edit-custom-search-types-c-doc"><input type="radio" id="edit-custom-search-types-c-doc" name="custom_search_types" value="c-doc" class="form-radio"> Documentation</label>
</div>
<div class="form-item" id="edit-custom-search-types-c-forum-wrapper">
 <label class="option" for="edit-custom-search-types-c-forum"><input type="radio" id="edit-custom-search-types-c-forum" name="custom_search_types" value="c-forum" class="form-radio"> Forum topic</label>
</div>
</div>
</div>
</div><a class="custom_search-popup-close" href="http://www.turnkeylinux.org/blog/django-signals#">Close</a></fieldset>
<input type="image" name="op" value="Search" id="edit-submit-1" alt="Search" class="form-submit custom-search-button" src="./Signals_files/icon-search.png">
<input type="hidden" name="form_build_id" id="form-e30e47986a55df3ec92a0a99a42bd34b" value="form-e30e47986a55df3ec92a0a99a42bd34b">
<input type="hidden" name="form_id" id="edit-search-theme-form" value="search_theme_form">
<input type="hidden" name="default_text" id="edit-default-text" value="Search" class="default-text">
</div>

</div></form>

</div>

                <div id="sidebar-left" class="sidebar">  <div class="block block-user" id="block-user-1">


    <div class="content"><ul class="menu"><li class="collapsed first"><a href="http://www.turnkeylinux.org/help">Help</a></li>
<li class="collapsed last"><a href="http://www.turnkeylinux.org/all" title="Listing of all TurnKey Linux virtual appliances">Virtual appliances</a></li>
</ul></div>
 </div>
  <div class="block block-simplenews" id="block-simplenews-48">

    <h3>News and Security Announcements</h3>

    <div class="content">      <p>Low-traffic newsletter: up to one email a month.</p>
  
      <form action="./Signals_files/Signals.htm" accept-charset="UTF-8" method="post" id="simplenews-block-form-48">
<div><div class="form-item" id="edit-mail-1-wrapper">
 <label for="edit-mail-1">Email: <span class="form-required" title="This field is required.">*</span></label>
 <input type="text" maxlength="128" name="mail" id="edit-mail-1" size="20" value="" class="form-text required">
</div>
<div class="form-radios"><div class="form-item" id="edit-action-subscribe-wrapper">
 <label class="option" for="edit-action-subscribe"><input type="radio" id="edit-action-subscribe" name="action" value="subscribe" checked="checked" class="form-radio"> Subscribe</label>
</div>
<div class="form-item" id="edit-action-unsubscribe-wrapper">
 <label class="option" for="edit-action-unsubscribe"><input type="radio" id="edit-action-unsubscribe" name="action" value="unsubscribe" class="form-radio"> Unsubscribe</label>
</div>
</div><input type="submit" name="op" id="edit-submit" value="Save" class="form-submit">
<input type="hidden" name="form_build_id" id="form-332660ca60faa9d866d5afef3ab4bd5f" value="form-332660ca60faa9d866d5afef3ab4bd5f">
<input type="hidden" name="form_id" id="edit-simplenews-block-form-48" value="simplenews_block_form_48">

</div></form>
  
      <div class="issues-link"><a href="http://www.turnkeylinux.org/announcements">Previous issues</a></div>
  
  
      <a href="http://www.turnkeylinux.org/taxonomy/term/48/0/feed" class="feed-icon"><img src="./Signals_files/feed.png" alt="Syndicate content" title="News and Security Announcements feed" width="16" height="16"></a>  </div>
 </div>
  <div class="block block-block" id="block-block-16">


    <div class="content"><iframe src="data:text/html,chromewebdata" scrolling="no" frameborder="0" style="margin-left: 8px; border:none; overflow:hidden; width:195px; height:373px;" allowtransparency="true"></iframe></div>
 </div>
  <div class="block block-tagadelic" id="block-tagadelic-7">

    <h3>Categories</h3>

    <div class="content"><a href="http://www.turnkeylinux.org/blog/amazon" class="tagadelic level1" rel="tag">amazon</a> 
<a href="http://www.turnkeylinux.org/blog/appliances" class="tagadelic level2" rel="tag">appliances</a> 
<a href="http://www.turnkeylinux.org/blog/aws" class="tagadelic level3" rel="tag">aws</a> 
<a href="http://www.turnkeylinux.org/blog/backup" class="tagadelic level1" rel="tag">backup</a> 
<a href="http://www.turnkeylinux.org/blog/cloud" class="tagadelic level3" rel="tag">cloud</a> 
<a href="http://www.turnkeylinux.org/blog/community" class="tagadelic level1" rel="tag">community</a> 
<a href="http://www.turnkeylinux.org/blog/core" class="tagadelic level1" rel="tag">core</a> 
<a href="http://www.turnkeylinux.org/blog/debian" class="tagadelic level1" rel="tag">debian</a> 
<a href="http://www.turnkeylinux.org/blog/development" class="tagadelic level3" rel="tag">development</a> 
<a href="http://www.turnkeylinux.org/blog/django" class="tagadelic level1" rel="tag">django</a> 
<a href="http://www.turnkeylinux.org/blog/drupal" class="tagadelic level2" rel="tag">drupal</a> 
<a href="http://www.turnkeylinux.org/blog/ec2" class="tagadelic level3" rel="tag">ec2</a> 
<a href="http://www.turnkeylinux.org/blog/hub" class="tagadelic level3" rel="tag">hub</a> 
<a href="http://www.turnkeylinux.org/blog/news" class="tagadelic level3" rel="tag">news</a> 
<a href="http://www.turnkeylinux.org/blog/python" class="tagadelic level1" rel="tag">python</a> 
<a href="http://www.turnkeylinux.org/blog/s3" class="tagadelic level1" rel="tag">s3</a> 
<a href="http://www.turnkeylinux.org/blog/security" class="tagadelic level1" rel="tag">security</a> 
<a href="http://www.turnkeylinux.org/blog/tklbam" class="tagadelic level2" rel="tag">tklbam</a> 
<a href="http://www.turnkeylinux.org/blog/ubuntu" class="tagadelic level2" rel="tag">ubuntu</a> 
<a href="http://www.turnkeylinux.org/blog/web" class="tagadelic level1" rel="tag">web</a> 
<div class="more-link"><a href="http://www.turnkeylinux.org/tagadelic/chunk/7">more tags</a></div></div>
 </div>
  <div class="block block-views" id="block-views-blog-block_3">

    <h3>Recent posts</h3>

    <div class="content"><div class="view view-blog view-id-blog view-display-id-block_3 view-dom-id-1 views-processed">
    
  
  
      <div class="view-content">
      <div class="item-list">
    <ul>
          <li class="views-row views-row-1 views-row-odd views-row-first">  
  <div class="views-field-title">
                <span class="field-content"><a href="http://www.turnkeylinux.org/blog/core-rc-squeeze-builds">TurnKey Core 12.0 RC optimized builds</a></span>
  </div>
  
  <div class="views-field-created">
                <span class="field-content">16th Apr, 2012</span>
  </div>
</li>
          <li class="views-row views-row-2 views-row-even">  
  <div class="views-field-title">
                <span class="field-content"><a href="http://www.turnkeylinux.org/blog/hub-snapshots">New Hub feature: Server snapshots</a></span>
  </div>
  
  <div class="views-field-created">
                <span class="field-content">4th Apr, 2012</span>
  </div>
</li>
          <li class="views-row views-row-3 views-row-odd">  
  <div class="views-field-title">
                <span class="field-content"><a href="http://www.turnkeylinux.org/blog/core-rc-squeeze">TurnKey Core 12.0 RC based on Debian Squeeze</a></span>
  </div>
  
  <div class="views-field-created">
                <span class="field-content">1st Mar, 2012</span>
  </div>
</li>
          <li class="views-row views-row-4 views-row-even">  
  <div class="views-field-title">
                <span class="field-content"><a href="http://www.turnkeylinux.org/blog/fast-rsync-mirrors">Rsync the entire TurnKey library from a mirror close to you in under 5 minutes!</a></span>
  </div>
  
  <div class="views-field-created">
                <span class="field-content">22nd Feb, 2012</span>
  </div>
</li>
          <li class="views-row views-row-5 views-row-odd views-row-last">  
  <div class="views-field-title">
                <span class="field-content"><a href="http://www.turnkeylinux.org/blog/announcing-xen-builds">Announcing TurnKey Xen optimized builds</a></span>
  </div>
  
  <div class="views-field-created">
                <span class="field-content">10th Feb, 2012</span>
  </div>
</li>
      </ul>
</div>    </div>
  
      <div class="item-list"><ul class="pager"><li class="pager-previous first">&nbsp;</li>
<li class="pager-current">1 of 24</li>
<li class="pager-next last"><a href="http://www.turnkeylinux.org/blog/django-signals?page=1" class="active">››</a></li>
</ul></div>  
  
  
  
  
</div> </div>
 </div>
  <div class="block block-views" id="block-views-recent_comments-block_2">

    <h3>Recent comments</h3>

    <div class="content"><div class="view view-recent-comments view-id-recent_comments view-display-id-block_2 view-dom-id-2">
    
  
  
      <div class="view-content">
      <div class="item-list">
    <ul>
          <li class="views-row views-row-1 views-row-odd views-row-first">  
  <div class="views-field-subject">
                <span class="field-content"><a href="http://www.turnkeylinux.org/blog/django-profile#comment-12913">Took me time to read all the</a></span>
  </div>
</li>
          <li class="views-row views-row-2 views-row-even">  
  <div class="views-field-subject">
                <span class="field-content"><a href="http://www.turnkeylinux.org/blog/announcing-openstack-builds#comment-12909">TurnKey Core 12.0rc available for OpenStack</a></span>
  </div>
</li>
          <li class="views-row views-row-3 views-row-odd">  
  <div class="views-field-subject">
                <span class="field-content"><a href="http://www.turnkeylinux.org/blog/openvz-proxmox#comment-12891">Guessing you probably found the answer by now...</a></span>
  </div>
</li>
          <li class="views-row views-row-4 views-row-even">  
  <div class="views-field-subject">
                <span class="field-content"><a href="http://www.turnkeylinux.org/blog/openvz-proxmox#comment-12886">TurnKey Core 12.0rc now available in TurnKey PVE channel</a></span>
  </div>
</li>
          <li class="views-row views-row-5 views-row-odd">  
  <div class="views-field-subject">
                <span class="field-content"><a href="http://www.turnkeylinux.org/blog/hub-snapshots#comment-12881">From my understanding</a></span>
  </div>
</li>
          <li class="views-row views-row-6 views-row-even">  
  <div class="views-field-subject">
                <span class="field-content"><a href="http://www.turnkeylinux.org/blog/hub-snapshots#comment-12878">Benefits over TKLBAM</a></span>
  </div>
</li>
          <li class="views-row views-row-7 views-row-odd views-row-last">  
  <div class="views-field-subject">
                <span class="field-content"><a href="http://www.turnkeylinux.org/blog/openvz-proxmox#comment-12868">Re installed</a></span>
  </div>
</li>
      </ul>
</div>    </div>
  
  
  
  
  
  
</div> </div>
 </div>
  <div class="block block-views" id="block-views-archive-block">

    <h3>Archive</h3>

    <div class="content"><div class="view view-archive view-id-archive view-display-id-block view-dom-id-3 views-processed">
    
  
  
      <div class="view-content">
      <div class="item-list">
  <ul class="views-summary">
      <li><a href="http://www.turnkeylinux.org/blog/archive/201204">April 2012</a>
              (2)
          </li>
      <li><a href="http://www.turnkeylinux.org/blog/archive/201203">March 2012</a>
              (1)
          </li>
      <li><a href="http://www.turnkeylinux.org/blog/archive/201202">February 2012</a>
              (3)
          </li>
      <li><a href="http://www.turnkeylinux.org/blog/archive/201201">January 2012</a>
              (1)
          </li>
      <li><a href="http://www.turnkeylinux.org/blog/archive/201112">December 2011</a>
              (4)
          </li>
      <li><a href="http://www.turnkeylinux.org/blog/archive/201111">November 2011</a>
              (4)
          </li>
      <li><a href="http://www.turnkeylinux.org/blog/archive/201110">October 2011</a>
              (3)
          </li>
      <li><a href="http://www.turnkeylinux.org/blog/archive/201109">September 2011</a>
              (3)
          </li>
      <li><a href="http://www.turnkeylinux.org/blog/archive/201108">August 2011</a>
              (3)
          </li>
      <li><a href="http://www.turnkeylinux.org/blog/archive/201107">July 2011</a>
              (3)
          </li>
      <li><a href="http://www.turnkeylinux.org/blog/archive/201106">June 2011</a>
              (4)
          </li>
      <li><a href="http://www.turnkeylinux.org/blog/archive/201105">May 2011</a>
              (5)
          </li>
    </ul>
</div>
    </div>
  
  
  
  
  
  
</div> </div>
 </div>
</div>
        
        

<ul id="fixedbtns">        

<li class="side_facebook"><a title="Find us on Facebook" href="http://www.facebook.com/turnkeylinux"></a></li>

<li class="side_twitter"><a title="Follow us on Twitter" href="http://twitter.com/turnkeylinux"></a></li>

<li class="side_rss"><a title="Subscribe to our blog" href="http://www.turnkeylinux.org/blog/feed"></a></li>
</ul>


      </div>

      <div id="left">&nbsp;</div>
      <div id="right">&nbsp;</div>
      <div id="bottom">&nbsp;</div>
      <div id="bg-right">&nbsp;</div>
      <div id="bottom-right">&nbsp;</div>
    </div>

    <div id="bg-left">&nbsp;</div>
    <div id="bottom-left">&nbsp;</div>

  </div>

  <script type="text/javascript">
<!--//--><![CDATA[//><!--
var _gaq = _gaq || [];_gaq.push(["_setAccount", "UA-5294846-3"]);_gaq.push(['_setCustomVar', 1, "roles", "anonymous user", 3]);_gaq.push(['_setCustomVar', 2, "node", "blog", 3]);_gaq.push(["_trackPageview"]);(function() {var ga = document.createElement("script");ga.type = "text/javascript";ga.async = true;ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";var s = document.getElementsByTagName("script")[0];s.parentNode.insertBefore(ga, s);})();
//--><!]]>
</script>



</body></html>